home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_bab_truckmove.cog < prev    next >
Text File  |  1999-11-15  |  14KB  |  414 lines

  1. # Jones 3D Cog Script
  2. #
  3. # BAB_Truckmove.cog
  4. # This cog is based on the brilliant groundbreaking cog work pioneered by Reed Derleth
  5. #
  6. # [SXC & revised by HB]
  7. #
  8. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. ## MESSAGES ##############################################################################
  14.  
  15. message     startup
  16. message     entered
  17. message     pulse
  18. message     user0
  19.  
  20. ## SURFACES ##############################################################################
  21.  
  22. surface     trigger
  23.  
  24. surface     stopface0       mask=0x004
  25. surface     stopface1       mask=0x004
  26.  
  27. surface     stopface2       mask=0x004
  28. surface     stopface3       mask=0x004
  29.  
  30. surface     stopface4       mask=0x004
  31. surface     stopface5       mask=0x004
  32. surface     stopface6       mask=0x004
  33.  
  34. ## THINGS ################################################################################
  35.  
  36. thing        truck
  37. thing       startpos
  38. thing       door0
  39. thing       door0a
  40. thing       door1
  41. thing       door2
  42. thing       door3
  43. thing       door4
  44. thing       player              local
  45. thing       actorindy
  46. thing       spinpos 
  47. thing       teleport_pos
  48. thing       invisitruck
  49.  
  50. ## CAMERAS ###############################################################################
  51.  
  52. thing       cam0                                        nolink
  53. thing       cam0_tgt0                                    nolink
  54. thing       cam1                                        nolink
  55. thing       cam1_tgt0                                    nolink
  56. thing       cam1_tgt1                                    nolink
  57. thing       nd_look_tgt0                                nolink
  58. thing       nd_move_tgt0                                nolink
  59. thing        nd_move_tgt1                                nolink
  60. thing       nd_look_tgt1                                nolink
  61. thing       hint28
  62.  
  63. ## SOUNDS ################################################################################
  64.  
  65. sound       truckline=bb03j03.wav                        local //3.75 sec
  66. sound       theme=mus_gen_danger2.wav                    local
  67. sound       metaldoor_start=bab_gate_start.wav          local
  68. sound       metaldoor_move=bab_gate_move.wav            local
  69. sound       metaldoor_stop=bab_gate_stop.wav            local
  70. sound       trucktheme=mus_bab_truck.wav                local
  71.  
  72. ## KEYFRAMES #############################################################################
  73.  
  74. keyframe    in_leanin=0in_leanin_2_2.key                local
  75. keyframe    in_handsONhips=0in_stand4.key                local
  76. keyframe    in_sideTOhips=0in_stand1_bd_4.key            local
  77. keyframe    in_armsCrossed=0in_stand2.key                local
  78. keyframe    in_crossArms=0in_stand1_bd_2.key               local //48x
  79.  
  80. ## MISC ##################################################################################
  81.  
  82. int            curframe=0            local
  83. int            begun=0                local
  84. int            crossframe=0        local
  85. int         aimessageblock=0    local
  86. int         killflag=0          local
  87. int         in_track0            local     
  88. int         firsttime=0         local
  89. int         doorchan=0          local
  90. int         isontruck=0         local
  91. int         sceneflag=0         local
  92. int         schollhack=0        local
  93.  
  94. vector      kickvector          local
  95.  
  96. flex        in_rotRate            local
  97. flex        in_headRate         local
  98. flex        range               local
  99.  
  100. ##########################################################################################
  101.  
  102. end
  103.  
  104. # ========================================================================================
  105. code
  106.  
  107. startup:
  108.  
  109.     SetThingFlags(truck, 0x80000);      //set truck inviso
  110.     SetCollideType(door0, 0);
  111.     SetCollideType(door0a, 0);
  112.     player = GetLocalPlayerThing();
  113.     kickvector = VectorSet(0, 2, 0);
  114.     in_headRate = GetThingMaxHeadVel(player);
  115.     in_rotRate = GetThingMaxRotVel(player);
  116.     
  117. return;
  118.  
  119. # ........................................................................................
  120. entered:
  121.  
  122.     if ((GetSenderRef() == trigger) &&
  123.          (begun == 0))
  124.         {
  125.             begun = 1;
  126.             //actor visible player invisible
  127.             MakeMeStop();
  128.             StartCutscene(1);
  129.             CopyPlayerHolsters(player, actorindy);
  130.             SetThingFlags(player, 0x80000);
  131.             ClearThingFlags(actorindy, 0x80000);
  132.             ClearThingFlags(truck, 0x80000);
  133.             AttachThingToThing(hint28, truck);
  134.             
  135.             //Set camera to track Indy...
  136.             AISetCutsceneMode(actorindy);
  137.             SetCameraFocus(2, cam0);
  138.             SetCameraSecondaryFocus(2, cam0_tgt0);
  139.             SetCurrentCamera(2);
  140.             SetCameraFOV(45, 0, 0);
  141.             Sleep(0.01);
  142.             SetCameraFOV(30, 1, 3.0);
  143.             
  144.             //Walk Indy forward to overlook...
  145.             AttachThingToThing(cam0_tgt0, actorindy);
  146.             SetThingMaxHeadVel(actorindy, 100.0);            
  147.             SetThingMaxRotVel(actorindy, 200.0);
  148.             AISetMoveSpeed(actorindy, 0.9);
  149.             AISetLookThingEyeLevel(actorindy, nd_look_tgt0);
  150.             AISetMoveThing(actorindy, nd_move_tgt0, 0);
  151.             Sleep(2.8);
  152.             AISetLookThingEyeLevel(actorindy, nd_move_tgt1);
  153.             AISetMoveThing(actorindy, nd_move_tgt1, 0);
  154.             PlaySoundLocal(trucktheme, 0, 0, 0, 0);
  155.                Sleep(0.7);
  156.  
  157.             AIEnableHeadTracking(actorindy, cam1_tgt1);
  158.             AIWaitForStop(actorindy);
  159.             AISetLookThing(actorindy, cam1_tgt1);
  160.             AIWaitForStop(actorindy);
  161.             AIDisableHeadTracking(actorindy);             
  162.             DetachThing(cam0_tgt0);            
  163.             in_track0 = PlayKey(actorindy, in_handsONhips, 2, 0x00, 0);
  164.             PlayKey(actorindy, in_sideTOhips, 4, 0x12, 1);
  165.  
  166.             //Pan to truck...
  167.             SetCameraLookInterp(2, 1);
  168.             SetCameraInterpSpeed(2, 1.35);
  169.             AttachThingToThing(nd_look_tgt1, truck);
  170.             Sleep(0.01);
  171.             SetCameraSecondaryFocus(2, nd_look_tgt1);
  172.             SetCameraFOV(30, 1, 1.35);
  173.              PlaySoundLocal(trucktheme, 1, 0, 0, 0); 
  174.             Sleep(1.5);
  175.             StopKey(actorindy, in_track0, 0.5);
  176.             //Sleep(0.5);
  177.             
  178.             //Kick truck to start it moving 1st time...
  179.             SetCameraLookInterp(2, 0); # lock target rigidly onto truck
  180.              SetThingThrust(truck, kickvector);
  181.             AIEnableBodyTracking(actorindy, truck); 
  182.             SetCameraFOV(60, 1, 3.0);     
  183.             return;
  184.         }
  185.   
  186. //AT TOP OF HILL
  187.     if ((GetSenderRef() == stopface0) && (GetSourceRef() == truck))
  188.         {
  189.             StopThing(truck);
  190.             Sleep(1);
  191.             PlaySoundThing(metaldoor_start, door0, 1, 10, 50, 0x0080);
  192.             MoveToFrame(door0, 1, 1);
  193.             MoveToFrame(door0a, 1, 1);
  194.             doorchan=PlaySoundThing(metaldoor_move, door0, 1, 10, 50, 0x0081);
  195.             WaitForStop(door0);
  196.             StopSound(doorchan, 0);
  197.             PlaySoundThing(metaldoor_stop, door0, 1, 10, 50, 0x0080);
  198.             SetThingThrust(truck, kickvector);
  199.             return;
  200.         }
  201.         
  202.     if ((GetSenderRef() == stopface1) && (GetSourceRef() == truck))
  203.         {
  204.             StopThing(truck);
  205.             Sleep(1);
  206.             PlaySoundThing(metaldoor_start, door0, 1, 10, 50, 0x0080);
  207.             MoveToFrame(door0, 0, 1);
  208.             MoveToFrame(door0a, 0, 1);
  209.             MoveToFrame(door3, 0, 1);
  210.             MoveToFrame(door4, 0, 1);
  211.             doorchan=PlaySoundThing(metaldoor_move, door0, 1, 10, 50, 0x0081);
  212.             WaitForStop(door0);
  213.             StopSound(doorchan, 0);
  214.             PlaySoundThing(metaldoor_stop, door0, 1, 10, 50, 0x0080);
  215.             Sleep(1);
  216.             SetThingThrust(truck, kickvector);
  217.             SetCollideType(door1, 0);  
  218.             SetCollideType(door2, 0);
  219.             return;
  220.         }            
  221.          
  222.         
  223. //AT FRONT GATE    
  224.     if ((GetSenderRef() == stopface2) && (GetSourceRef() == truck))
  225.         {
  226.             //print("at stopface2");
  227.             StopThing(truck);
  228.             Sleep(1);
  229.             PlaySoundThing(metaldoor_start, door1, 1, 10, 50, 0x0080);
  230.             MoveToFrame(door1, 1, 1);
  231.             MoveToFrame(door2, 1, 1);
  232.             doorchan=PlaySoundThing(metaldoor_move, door1, 1, 10, 50, 0x0081);
  233.             WaitForStop(door2);
  234.             StopSound(doorchan, 0);
  235.             PlaySoundThing(metaldoor_stop, door1, 1, 10, 50, 0x0080);
  236.             SetCollideType(door1, 0);
  237.             SetCollideType(door2, 0);
  238.             SetThingThrust(truck, kickvector);
  239.             return;
  240.         }   
  241.         
  242.     if ((GetSenderRef() == stopface3) && (GetSourceRef() == truck))
  243.         {
  244.             //print("entering stopface3");
  245.             StopThing(truck);            
  246.             Sleep(1);
  247.             PlaySoundThing(metaldoor_start, door1, 1, 10, 50, 0x0080);
  248.             MoveToFrame(door1, 0, 1);
  249.             MoveToFrame(door2, 0, 1);
  250.             doorchan=PlaySoundThing(metaldoor_move, door1, 1, 10, 50, 0x0081);
  251.             WaitForStop(door1);
  252.             StopSound(doorchan, 0);
  253.             PlaySoundThing(metaldoor_stop, door1, 1, 10, 50, 0x0080);
  254.             Sleep(1);
  255.             SetThingThrust(truck, kickvector);
  256.             SetCollideType(door3, 0);  
  257.             SetCollideType(door4, 0);
  258.             
  259.             //Continue cutscene...
  260.             if (begun == 1)
  261.             {
  262.                 begun=2;
  263.                 
  264.                 //cut to shot of Indy...
  265.                 SetCameraFocus(2, cam1);
  266.                 SetCameraSecondaryFocus(2, cam1_tgt0);
  267.                 SetCameraFOV(40, 0, 0.0);
  268.                 Sleep(0.01);
  269.                 SetCameraFOV(25, 1, 5.35); //cover crossarms plus truckline
  270.                 DetachThing(nd_look_tgt1);
  271.                 AIDisableBodyTracking(actorindy);
  272.                 in_track0 = PlayKey(actorindy, in_armsCrossed, 2, 0x00, 0);
  273.                 PlayKey(actorindy, in_crossArms, 4, 0x12, 1);
  274.                 PlayVoice(actorindy, truckline, 1, 1);
  275.                 StopKey(actorindy, in_track0, 0.5);
  276.                 Sleep(0.5);
  277.                 
  278.                 //Print("resetting camera");
  279.                 //Sleep(0.5);
  280.                 CopyOrientAndPos(actorindy, player);
  281.                 SetCameraLookInterp(2, 0);
  282.                 SetCameraPosInterp(2, 0);
  283.                 SetCameraInterpSpeed(2, 0);
  284.                 Sleep(0.01);
  285.                 SetCameraPosition(1, GetThingPos(spinpos));
  286.                 ClearThingFlags(player, 0x80000);
  287.                 SetThingMaxHeadVel(actorindy, in_headRate); //restore
  288.                 SetThingMaxRotVel(actorindy, in_rotRate); //restore
  289.                 SetThingFlags(actorindy, 0x80000);
  290.                 SetCurrentCamera(1);
  291.                 ResetCameraFOV(0, 0.0);
  292.                 EndCutscene();
  293.                 ClearActorFlags(player, 0x200000);
  294.                 return;
  295.             }
  296.             return;
  297.         }
  298.         
  299. //EXITING SIDE OF COURTYARD    
  300.     if ((GetSenderRef() == stopface4) && (GetSourceRef() == truck))
  301.         {
  302.             if (firsttime == 0)
  303.             {
  304.                 firsttime=1;
  305.                 TeleportThing(truck, startpos);
  306.                 TeleportThing(hint28, startpos);
  307.                 AttachThingToThing(hint28, truck);
  308.                 CopyOrient(truck, teleport_pos); 
  309.                 AttachThingToThingEx(teleport_pos, truck, 0x000C);
  310.                 CopyOrient(truck, invisitruck);
  311.                 AttachThingToThingEx(invisitruck, truck, 0x000C);
  312.                 Sleep(1);
  313.                 SetThingThrust(truck, kickvector);
  314.                 MoveToFrame(door3, 0, 1);
  315.                 MoveToFrame(door4, 0, 1);
  316.                 return;
  317.             }
  318.             StopThing(truck);
  319.             Sleep(10);
  320.             //checks to see if indy is near truck
  321.             range = ABS(VectorDist(GetThingPos(truck), GetThingPos(player)));
  322.             SetPulse(1);
  323.             While (range < 0.6)
  324.             {
  325.                 //print("..");
  326.                 //printflex(range); 
  327.                 Sleep(0.5);   
  328.             }    
  329.             
  330.             Sleep(1);
  331.             PlaySoundThing(metaldoor_start, door3, 1, 10, 50, 0x0080);
  332.             MoveToFrame(door3, 1, 1);
  333.             MoveToFrame(door4, 1, 1);
  334.             doorchan=PlaySoundThing(metaldoor_move, door3, 1, 10, 50, 0x0081);
  335.             WaitForStop(door3);
  336.             StopSound(doorchan, 0);
  337.             PlaySoundThing(metaldoor_stop, door3, 1, 10, 50, 0x0080);
  338.             SetCollideType(door3, 0);
  339.             SetCollideType(door4, 0);
  340.             Sleep(1);
  341.             SetThingThrust(truck, kickvector);
  342.             return;
  343.         }
  344.         
  345.     if ((GetSenderRef() == stopface5) && (GetSourceRef() == truck))
  346.         {
  347.             //print("entered stopface 5");
  348.             StopThing(truck);
  349.             Sleep(1);
  350.             PlaySoundThing(metaldoor_start, door3, 1, 10, 50, 0x0080);
  351.             MoveToFrame(door3, 0, 1);
  352.             MoveToFrame(door4, 0, 1);
  353.             doorchan=PlaySoundThing(metaldoor_move, door3, 1, 10, 50, 0x0081);
  354.             WaitForStop(door3);
  355.             StopSound(doorchan, 0);
  356.             PlaySoundThing(metaldoor_stop, door3, 1, 10, 50, 0x0080);
  357.             Sleep(1);
  358.             SetThingThrust(truck, kickvector);
  359.             return;
  360.         }
  361.         
  362. //TELEPORT TRUCK BACK TO STARTPOINT
  363.     if ((GetSenderRef() == stopface6) && (GetSourceRef() == truck))
  364.         {
  365.             //print("entered stopface 6");
  366.             StopThing(truck);
  367.             
  368.             //kill truck move because steve scholl didn't want to fix this bug
  369.             if (schollhack == 1)
  370.             {
  371.                  SetThingFlags(truck, 0x80000);
  372.                  DestroyThing(truck);
  373.                  return;
  374.             }
  375.             
  376.             TeleportThing(truck, startpos);
  377.             TeleportThing(hint28, startpos);
  378.             AttachThingToThing(hint28, truck);
  379.             CopyOrient(truck, teleport_pos);
  380.             AttachThingToThingEx(teleport_pos, truck, 0x000C);
  381.             CopyOrient(truck, invisitruck);
  382.             AttachThingToThingEx(invisitruck, truck, 0x000C);
  383.             Sleep(1);
  384.             SetThingThrust(truck, kickvector);
  385.             return;
  386.         }
  387.         
  388. return;
  389.  
  390. # .......................................................................................
  391. pulse:
  392.  
  393.     If (range > 0.6)
  394.     {
  395.         SetPulse(0);
  396.         return;
  397.     }
  398.  
  399.     range = ABS(VectorDist(GetThingPos(truck), GetThingPos(player)));
  400.     
  401. return;
  402.  
  403. # .......................................................................................
  404. user0:
  405.  
  406.     schollhack=1;
  407.     
  408. return;
  409.  
  410. # .......................................................................................
  411.     
  412. end
  413.  
  414.